home *** CD-ROM | disk | FTP | other *** search
- ; Program Name : Mickup.asm
- ; Author : bill buckels
- ; Date : October 1990
- ; Function : TSR Display of Mouse Functions
-
- ;Grateful Acknowledgement: TSR Outline and set-up by Jeff Prosise 1986
- ;initialization and keyboard scanning and screen write routines verbatim
- ;but bios scrolling functions appended with direct screen writes
-
- kb_data equ 60h ;keyboard data port
- kb_ctrl equ 61h ;keyboard control port
- eoi equ 20h ;8259 end-of-interrupt value
- int_ctrl_port equ 20h ;8259 PIC port
- m_key equ 32h ;scan code for 'M' key
- alt_key equ 8 ;shift code for Alt key
- cr equ 0dh ;carriage return
- lf equ 0ah ;line feed
- null equ 00h ;nothing
- ;
- bios_data segment at 40h ;BIOS data area
- org 63h
- addr_6845 dw ? ;6845 Index Register address
- bios_data ends
- ;
- code segment para public 'code'
- assume cs:code
- org 100h
- begin: jmp initialize ;jump to initialization code
- ;
- notice db 'Copyright(C) 1990 by Bill Buckels'
- notice2 db 'programmed by Bill Buckels'
-
- ibm_signature db 'IBM' ;EGA BIOS signature
- adapter db 2 ;0 = CGA, 1 = MDA, 2 = EGA
- video_segment dw 0B800h ;video segment address
- video_page db ? ;current video page
- border_attr db 1bh ;window border attribute
- text_attr db 1Fh ;window text attribute
- header_attr db 1Eh ;window header attribute
- reverse_attr db 4Eh ;reverse color attr
- title_attr db 4bh ;title attribute
- window_row db 0 ;row of left corner of window
- window_column db 0 ;column of left corner of window
- start_value db 0 ;first mouse function
- func_index db 0 ;mouse function counter
- old_index db 0 ;old counter
- int_status db 0 ;status of interrupt routine
- cursor_mode dw ? ;cursor scan line definition
- old_int_9h label dword ;old interrupt vector
- old_keyboard_int dw 2 dup (?)
- screen_buffer dw offset initialize ;pointer to screen buffer area
- ;
- enable_values db 2Ch,28h,2Dh,29h ;values to enable CGA display
- db 2Ah,2Eh,1Eh
- ;
- ;--------------------------------------------------------------------
- ;initialization messages
- ;--------------------------------------------------------------------
- credit$ db ' Mickup(C) Copyright 1990 by Bill Buckels',cr,lf
- db 'Mouse Function Pop-Up Summary is Now Installed',cr,lf
- db 'Hotkey Combination is Alt-M',cr,lf,'$'
-
- header_text db ' Mickup(C) Copyright 1990 ' ;window header text
-
- titleblock db '────────────────────────────',cr
- db ' Programmer Reference ',cr
- db ' and ',cr
- db ' Mouse Function Summary ',cr
- db '────────────────────────────',cr
- db ' by William J. Buckels ',null
-
- XMOUSE db 'The mouse requires a resident program called a', cr
- db 'driver to be able to perform its functions. The', cr
- db 'primary access to the driver is software int 33h',cr
- db 'Before accessing the driver a check should be', cr
- db 'made to see if it is resident. If neither the', cr
- db 'offset or segment of the mouse vector are 0,it', cr
- db 'is safe to issue a mouse function call.', cr
- db cr
- db 'Calls to the driver are issued by loading only', cr
- db 'the registers required for the call, then by', cr
- db 'issuing int 33h. Primary registers are AX, BX,', cr
- db 'CX, and DX (m1,m2,m3,and m4). Certain functions', cr
- db '(9,12,20,22, and 24) require long pointers to be',cr
- db 'specified in the ES:DX register pair. Function', cr
- db '31 returns a long pointer in ES:BX.', cr
- db cr
- db 'The driver deals in Mouse screen coordinates', cr
- db 'which are comensurate with actual video mode.', cr
- db '───────────────────────────────────────────────', cr
- db ' Use The Cursor Pad To SELECT', cr
- db ' The Function of Interest', cr
- db ' Press ENTER to toggle A Summary of Use', null
-
- ;----------------------------------------------------------------
- ;mouse function text
- ;----------------------------------------------------------------
-
- FUNC00 db ' 0 Initialize Driver ', null
- FUNC01 db ' 1 Show Cursor ', null
- FUNC02 db ' 2 Hide Cursor ', null
- FUNC03 db ' 3 Get Cursor and Button ', null
- FUNC04 db ' 4 Set Cursor Position ', null
- FUNC05 db ' 5 Get Button Press Data ', null
- FUNC06 db ' 6 Get Button Release Data ', null
- FUNC07 db ' 7 Set Horizontal Clipping ', null
- FUNC08 db ' 8 Set Vertical Clipping ', null
- FUNC09 db ' 9 Define Graphics Cursor ', null
- FUNC10 db '10 Define Text Cursor ', null
- FUNC11 db '11 Read Motion Counters ', null
- FUNC12 db '12 Define User Subroutine ', null
- FUNC13 db '13 Light Pen Emulation ON ', null
- FUNC14 db '14 Light Pen Emulation OFF ', null
- FUNC15 db '15 Set Counts per 8-Pixe1s ', null
- FUNC16 db '16 Define Cond. OFF Window ', null
- FUNC17 db '17 Not available:internal ', null
- FUNC18 db '18 Not available:internal ', null
- FUNC19 db '19 Set Dble-Speed Threshold ', null
- FUNC20 db '20 Exchange User Sub Vector ', null
- FUNC21 db '21 Get Size Mouse State Buff', null
- FUNC22 db '22 Save Mouse State ', null
- FUNC23 db '23 Restore Mouse State ', null
- FUNC24 db '24 Define Alternate User Sub', null
- FUNC25 db '25 Read Alternate Sub Vector', null
- FUNC26 db '26 Set Scaling Factors ', null
- FUNC27 db '27 Get Mouse Scaling Factors', null
- FUNC28 db '28 Reserved ', null
- FUNC29 db '29 Set Active Display Page ', null
- FUNC30 db '30 Get Active Display Page ', null
- FUNC31 db '31 Disable Mouse Driver ', null
- FUNC32 db '32 Enable Mouse Driver ', null
- FUNC33 db '33 Software Reset ', null
- FUNC34 db '34 Set Language Byte ', null
- FUNC35 db '35 Read Language Byte ', null
- FUNC36 db '36 Get Mouse & Driver Data ', null
-
- ;----------------------------------------------------------------
- ;maximum size of explanation is 22 rows x 48 columns
- ;each line is seperated by a carriage return and the
- ;explanation is terminated with a null byte
- ;multiple pages are delineated with a lf as a pagebreak
- ;----------------------------------------------------------------
-
- XFUNC00 db ' Function 0 Reset Driver', cr
- db ' ----------------------------', cr
- db 'Call: AX = 0', cr
- db cr
- db 'Return: AX = Oxffff if Mouse Driver is Active', cr
- db ' BX = Number of Independent Buttons (2)', cr
- db cr
- db 'This function configures the mouse port and sets',cr
- db 'internal driver variables to Driver Defaults:', cr
- db cr
- db 'Cursor Level Counter -1', cr
- db 'Graphics Cursor Left Leaning UpArrow',cr
- db 'Graphics Cursor Hot Spot (-1,-1)', cr
- db 'Text Cursor = Rev Video Box:Screen Mask ffffH',cr
- db ' Cursor Mask 7700H',cr
- db 'User Subroutine Condition Mask Disabled 0', cr
- db 'Light Pen Emulation ON', cr
- db 'Mouse-Counts per 8-Pixe1s 8', cr
- db 'Mouse-Counts per 8-rasters 16', cr
- db 'Double-Speed Threshold in Mickeys per second 120',cr
- db 'Cursor Range in Pixels 0 to 639',cr
- db 'Cursor Range in Rasters 0 to 199',null
-
- XFUNC01 db ' Function 1 Show Cursor', cr
- db ' ---------------------------', cr
- db 'Call: AX = 1', cr
- db cr
- db 'Return: None', cr
- db cr
- db 'This function increments the cursor level count', cr
- db 'in the driver. When the cursor level = zero the', cr
- db 'driver will plot the tracking cursor on screen.', cr
- db 'Successive calls to Func 1 will not increase', cr
- db 'the cursor level above zero.', cr
- db cr
- db 'The cursor level variable is provided as a way', cr
- db 'for a program to handle multiple levels of', cr
- db 'hiding a cursor. The mouse cursor is drawn by', cr
- db 'the driver whenever the user moves his mouse.', cr
- db 'It is necessary to hide the cursor before', cr
- db 'altering the screen under the cursor, or', cr
- db 'scrolling the screen The cursor level counter', cr
- db 'keeps hides and shows nested correctly in', cr
- db 'complex programs.', null
-
- XFUNC02 db ' Function 2 Hide Cursor', cr
- db ' ---------------------------', cr
- db 'Call: AX = 2', cr
- db cr
- db 'Return: None', cr
- db cr
- db 'This function decrements the cursor level count', cr
- db 'in the driver. If the cursor is currently', cr
- db 'displayed it will be removed from the screen.', cr
- db 'Successive calls to Function 2 will continue', cr
- db 'to decrease the cursor level below zero.Thus you',cr
- db 'must have a matching show for each hide.', null
-
- XFUNC03 db 'Function 3 Get Cursor Position and Button Status',cr
- db '------------------------------------------------',cr
- db 'Call: AX = 3', cr
- db cr
- db 'Return: BX = Button Status', cr
- db 'CX = Horizontal Position in Mouse-Screen Pixels',cr
- db 'DX = Vertical Position in Mouse-Screen Rasters', cr
- db cr
- db 'Button Status is given in the 2 leastsignificant',cr
- db 'bits of the 16-bit register BX as follows:', cr
- db ' Bit # ---> 15 14 ... 2 1 0', cr
- db ' Value ---> 0 0 ... 0 R L', cr
- db 'where R is Right button and L the Left button.', cr
- db 'A button bit is one if that button is pressed.', cr
- db 'Note that pressing the Middle button of the', cr
- db 'mouse is equivalent to the simultaneous press of',cr
- db 'the Left and Right buttons.The coordinate return',cr
- db 'in CX and DX is in Mouse-Screen coordinates.', cr
- db 'The mouse driver automatically changes internal', cr
- db 'operating mode and coordinate system on display', cr
- db 'mode change through a BIOS INT10H call.', null
-
- XFUNC04 db ' Function 4 Set Cursor Position', cr
- db ' ------------------------------------', cr
- db 'Call :AX = 4', cr
- db ' BX = Mouse-Screen Pixels (Horiz.)', cr
- db ' CX = Mouse-Screen Rasters (Vertical)', cr
- db cr
- db 'Return:None', cr
- db cr
- db 'This function sets the XMOUSE cursor to a new', cr
- db 'position. The coordinates should be within the', cr
- db 'legal range of coordinates for the type of', cr
- db 'display screen in use.', null
-
-
- XFUNC05 db ' Function 5 Get Button Press Data', cr
- db ' -------------------------------------', cr
- db 'Call :AX = 5', cr
- db ' BX = Button Number (Left=O, Right=1)', cr
- db cr
- db 'Return:AX = Button Status', cr
- db ' BX = Number of Presses since last call', cr
- db ' CX = Mouse-Screen Pixels (H) last Press', cr
- db ' DX = Mouse-Screen Rasters (V) last Press',cr
- db cr
- db 'Button Status is given in the 2 leastsignificant',cr
- db 'bits of the 16-bit register BX as follows:', cr
- db ' Bit # ---) 15 14 ... 2 1 0', cr
- db ' Value ---) 0 0 ... 0 R L', cr
- db 'This function provides a count of the number of', cr
- db 'times a button has been pressed. The count is', cr
- db 'zeroed after each call to the function. Presses', cr
- db 'are counted separately from releases.The cursor', cr
- db 'coordinates returned in CX and DX are those at', cr
- db 'the moment of the last button press and may not', cr
- db 'be identical to the current cursor coordinates.', null
-
- XFUNC06 db ' Function 6 Get Button Release Data', cr
- db ' ---------------------------------------', cr
- db 'Call: AX = 6', cr
- db ' BX = Button Number (Left=O, Right=1)', cr
- db cr
- db 'Return:AX = Button Status', cr
- db ' BX = Number of Releases since last call', cr
- db ' CX = Mouse-Screen Pixels (H)last Release',cr
- db ' DX = Mouse-Screen Rasters(V)last Release',cr
- db cr
- db 'Button Status is given in the 2 leastsignificant',cr
- db 'bits of the 16-bit register BX as follows:', cr
- db ' Bit # ---) 15 14 ... 2 1 0', cr
- db ' Value ---) 0 0 --- 0 R L', cr
- db 'This function provides a count of the number of', cr
- db 'times a button has been released. The count is', cr
- db 'zeroed after each call to the function.', cr
- db 'Releases are counted separately from presses.', cr
- db 'The cursor coordinates returned in CX and DX', cr
- db 'are those at themoment of the last release and', cr
- db 'may not be the current cursor coordinates.', null
-
- XFUNC07 db ' Function 7 Set Horizontal Clipping', cr
- db ' ---------------------------------------', cr
- db 'Call: AX = 7', cr
- db ' CX = Minimum Mouse-Screen Pixel', cr
- db ' DX = Maximum Mouse-Screen Pixel', cr
- db cr
- db 'Return:None', cr
- db cr
- db 'This function allows you to set the maximum and', cr
- db 'minimum values for the horizontal position of', cr
- db 'the cursor. The cursor will be moved into the', cr
- db 'newly defined region if it is not already there.',cr
- db cr
- db 'If the Maximum Pixel is less than the Minimum', cr
- db 'then they will be exchanged.', null
-
- XFUNC08 db ' Function 8 Set Vertical Clipping', cr
- db ' --------------------------------------', cr
- db 'Call: AX = 8', cr
- db ' CX = Minimum Mouse-Screen Raster', cr
- db ' DX = Maximum Mouse-Screen Raster', cr
- db cr
- db 'Return:None', cr
- db cr
- db 'This function allows you to set the maximum and', cr
- db 'minimum values for the vertical position of the', cr
- db 'cursor. The cursor will be moved into the', cr
- db 'newly defined region if it is not already there.',cr
- db cr
- db 'If the Maximum Raster is less than the Minimum', cr
- db 'then they will be exchanged.', null
-
-
- XFUNC09 db ' Function 9 (Advanced) Define Graphics Cursor',cr
- db ' ----------------------------------------------',cr
- db 'Call: AX = 9', cr
- db ' BX = Horizontal Hot Spot', cr
- db ' CX = Vertical Hot Spot', cr
- db ' DX = Offset of Far Ptr to 32 int Array', cr
- db 'Return:None', cr
- db 'The far pointer must be defined by the ES:DX', cr
- db 'register Pair. Allows defining new cursor shapes',cr
- db 'for the graphics modes. Two bitmaps, each 16', cr
- db 'bits square are logically combined with display', cr
- db 'memory to create a cursor; the screen mask map', cr
- db 'is ANDed with the screen memory and then the', cr
- db 'result is XORed with the Cursor Mask bitmap.', cr
- db 'For EGA display modes the same operation is', cr
- db 'repeated with all of the planes in the display.', cr
- db 'Since the logical operations are conducted', cr
- db 'directly on screen memory the size of the cursor',cr
- db 'varies with the display mode. e.g in 640 x 200', cr
- db 'black and white graphics mode the cursor is', cr
- db '16 pixels by 16 rasters. In the 320 x 200 medres',cr
- db 'color mode the cursor is 8 PELS by 16 rasters.', null
-
- XFUNC10 db ' Function 10 Define Text Cursor', cr
- db ' ---------------------------------', cr
- db 'Call : AX = 10', cr
- db ' BX = Cursor Type', cr
- db ' CX = Screen Mask (or Scan Line Start)', cr
- db ' DX = Cursor Mask (or Scan Line Stop)', cr
- db cr
- db 'Return: None', cr
- db cr
- db 'This function is used to define a cursor in text',cr
- db 'modes. Cursor Type selects either a software', cr
- db 'cursor if BX = 0, or a hardware cursor', cr
- db 'if BX = 1.', null
-
- XFUNC11 db ' Function 11 (Advanced) Read Motion Counters', cr
- db ' --------------------------------------------', cr
- db 'Call: AX = 11', cr
- db cr
- db 'Return:CX = Horizontal Mouse-Counts', cr
- db ' DX = Vertical Mouse-Counts', cr
- db cr
- db 'This function provides direct access to relative',cr
- db 'movement of the mouse in mouse motion units or', cr
- db 'Mouse-Counts(Mickeys).The number of Mouse-Counts',cr
- db 'is proportional to the distance that the mouse', cr
- db 'moves. Functions #15,19,26 effect the impact of', cr
- db 'mouse motion upon the cursor motion.', cr
- db cr
- db 'Positive counts represent horizontal motion to', cr
- db 'the right and vertical motion down. The counts', cr
- db 'are signed 16 bit integers, and any overflow is', cr
- db 'ignored. The horizontal and vertical counts are', cr
- db 'zeroed after each call to this function.', null
-
- XFUNC12 db 'Function 12 (Advanced) Define User Subroutine', cr
- db '----------------------------------------------', cr
- db 'Call: AX = 12', cr
- db ' CX = User Defined Event Mask', cr
- db ' DX = Offset of Far Ptr to User Sub', cr
- db 'Return:None', cr
- db 'The far pointer must be defined by the ES:DX', cr
- db 'register pair. This function defines a set of', cr
- db 'conditions for which a user defined subroutine', cr
- db 'will be called by the mouse driver. The user', cr
- db 'defined subroutine is invoked when a mouse', cr
- db 'interrupt occurrs and one or more of the', cr
- db 'conditions defined by the Event Mask are met.', cr
- db 'The bits of the Event Mask are:', cr
- db ' Bit # ---> 15 . . . 5 4 3 2 1 0', cr
- db ' Func ---) x . . . x Rr Rp Lr Lp M', cr
- db 'M = Mouse Motion has occurred', cr
- db 'Lp = Left Button Pressed', cr
- db 'Lr = Left Button Released', cr
- db 'Rp = Right Button pressed', cr
- db 'Rr = Right Button Released', cr
- db 'x = Not used << press ENTER for MORE >>', lf
-
- XFUNC12A db 'Setting an Event Mask bit to one enables the', cr
- db 'condition. C1earing all bits to 0 Will disable', cr
- db 'all calls. Be certain to disable the call to', cr
- db 'your user defined subroutine Whenever you exit', cr
- db 'from your application. Otherwise the next mouse', cr
- db 'motion, Whether intentional or not, will cause', cr
- db 'a call through the now dangling reference to', cr
- db 'uninitialized memory. When the Event Mask', cr
- db 'conditions are satisfied and the Mouse Driver', cr
- db 'calls the User Subroutine, information is', cr
- db 'available in the following registers:', cr
- db 'AX = Event Integer - state of Event Mask Bits', cr
- db 'BX = Button Status', cr
- db 'CX = Cursor Pos in Mouse-Screen Pixels', cr
- db 'DX = Cursor Pos in Mouse-Screen Rasters', cr
- db 'DI = Motion Counter (Horizontal)', cr
- db 'SI = Motion Counter (Vertical)', cr
- db 'This function should only be used by experienced',cr
- db 'programmers.', null
-
- XFUNC13 db ' Function 13 Light Pen Emulation ON', cr
- db ' --------------------------------------', cr
- db cr
- db 'Call : AX = 13', cr
- db cr
- db 'Return : None', cr
- db cr
- db 'This function turns on emulation of a light pen', cr
- db 'for users of BASIC.', cr
- db 'Mouse motion will be used to simulate a light', cr
- db 'Pen. Pressing a button will store coordinates of',cr
- db 'the cursor. Each call to the BASIC PEN function', cr
- db 'will return a set of coordinates.', cr
- db cr
- db 'When no mouse buttons are depressed the PEN func',cr
- db 'will return a pen-up status.', null
-
- XFUNC14 db ' Function 14 Light Pen Emulation OFF', cr
- db ' ---------------------------------------', cr
- db 'Call : AX = 14', cr
- db cr
- db 'Return : None', cr
- db cr
- db 'This function turns off emulation of a light pen',null
-
- XFUNC15 db ' Function 15 Set Mouse-Counts per 8-Pixe1s,',cr
- db ' Mouse-Counts per 8-Rasters', cr
- db ' --------------------------------------------', cr
- db cr
- db 'Call :AX = 15', cr
- db ' CX = Mouse-Counts per 8-pixe1s (Hor)', cr
- db ' DX = Mouse-Counts per 8-rasters (Vert)', cr
- db cr
- db 'Return :None', cr
- db cr
- db 'This function sets the relationship between the', cr
- db 'mouse motion and the cursor motion. Small values',cr
- db 'mean that a small mouse motion produces a large', cr
- db 'cursor motion. Large values mean that a large', cr
- db 'mouse motion is required to achieve a given', cr
- db 'cursor motion. The range of these factors should',cr
- db 'be limited to 1 through 32767 but there is no', cr
- db 'overrange checking. A value exceeding 32767 is', cr
- db 'interpreted as a negative number and this will', cr
- db 'reverse cursor motion relative to mouse motion.', null
-
- XFUNC16 db 'Function 16 (advanced) Define Cursor OFF window',cr
- db '------------------------------------------------',cr
- db cr
- db 'Call Data: AX = 16', cr
- db ' CX = Minimum Mouse-Screen pixel', cr
- db ' DX = Minimum Mouse-Screen Raster', cr
- db ' SI = Maximum Mouse-Screen Pixel', cr
- db ' DI = Maximum Mouse-Screen Raster', cr
- db 'Return Data: none', cr
- db cr
- db 'If an application program modifies a region of', cr
- db 'the screen, the mouse cursor should be OFF so', cr
- db 'that the screen will not be garbled. To do this,',cr
- db 'the application turns Off the cursor, modifies', cr
- db 'the screen, then turns ON the cursor.', cr
- db 'If the cursor is outside of the region being', cr
- db 'modified, the cursor need not be turned OFF.', cr
- db 'Unnecessary hiding of the mouse cursor produces', cr
- db 'an annoying cursor blink.', cr
- db ' << press ENTER for MORE >>',lf
-
- XFUNC16A db 'This function defines a screen region where the', cr
- db 'cursor wlll not be Plotted. If the mouse cursor', cr
- db 'is within the region when the call is made, or', cr
- db 'if it enters the region it will be hidden.', cr
- db cr
- db 'A call to function 1 is needed to restore the', cr
- db 'cursor. Thus the application invokes Function', cr
- db '#16 followed by a turn-ON of the cursor', cr
- db '(function # 1). Function #16 will not turn Off', cr
- db 'the cursor un1ess it is in the defined region so',cr
- db 'blinking is greatly reduced.', cr
- db cr
- db 'In other words, Function #16 allows your', cr
- db 'software to update a portion of the screen', cr
- db 'without hiding the cursor before each screen', cr
- db 'update. Function #l after function #16 does', cr
- db 'nothing if the cursor Is already ON.', null
-
- XFUNC17 db 'Function 17 Not Available: Used internally by', cr
- db ' the Mouse Driver.', cr
- db '-----------------------------------------------', null
-
- XFUNC18 db 'Function 18 Not Available: Used internally by', cr
- db ' the Mouse Driver.', cr
- db '----------------------------------------------', null
-
- XFUNC19 db 'Function 19 Set Double-Speed Threshold', cr
- db '------------------------------------------', cr
- db 'Call: AX = 19', cr
- db ' DX = Double-Speed Threshold in', cr
- db ' Mouse_Counts/second', cr
- db 'Return : None', cr
- db cr
- db 'When the mouse is moved faster than this speed', cr
- db 'threshold the scaling between Mouse-Counts and', cr
- db 'screen pixels is temporarily doubled to increase',cr
- db 'the response of motion of the mouse cursor. The', cr
- db 'threshold is also affected by the Scaling Factor',cr
- db 'set by Function #26.', cr
- db cr
- db 'The default value is 120 mouse-counts per second',cr
- db 'To effectively disable the doublespeed threshold',cr
- db 'enter a large number that cannot be exceeded ...',cr
- db '15000 for example.', null
-
- XFUNC20 db 'Func20(Advanced)Exchange User Subroutine Vectors',cr
- db '------------------------------------------------',cr
- db 'Call : AX = 20', cr
- db ' CX = New User Defined Event Mask', cr
- db ' DX = New Offset of Far Pointer to', cr
- db ' User Defined Subroutine', cr
- db 'Return: CX = Old User Defined Event Mask', cr
- db ' DX = Old Offset of Far Pointer to', cr
- db ' User Defined Subroutine', cr
- db 'Far pointers defined by the ES:DX register pair.',cr
- db cr
- db 'This function is intended to be used by pop-up', cr
- db 'utilities and other programs that need to', cr
- db 'temporarily gain control of the mouse driver.', cr
- db 'By using this function, a popup can save the', cr
- db 'state of the foreground application Function 12', cr
- db 'subroutine and install its own mouse handler.', null
-
- XFUNC21 db 'Func 21(Advanced) Get Size of Mouse State Buffer',cr
- db '------------------------------------------------',cr
- db cr
- db 'Call Data: AX = 21', cr
- db cr
- db 'Return Data: BX = Buffer Size in Bytes', cr
- db cr
- db 'This function is intended to be used by popup', cr
- db 'utilities and other programs that need to', cr
- db 'temporarily gain control of the mouse driver.', cr
- db 'By using this function and functions 22 and 23,', cr
- db 'a popup can save the state of the mouse driver', cr
- db 'as set by the foreground application.', null
-
- XFUNC22 db ' Function 22 (Advanced) Save Mouse State', cr
- db ' ----------------------------------------', cr
- db cr
- db 'Call : AX = 22', cr
- db ' DX = Offset Far Pointer to Save-Buffer', cr
- db cr
- db 'Return: None', cr
- db cr
- db 'Far Pointer defined by the ES:DX register pair.', cr
- db cr
- db 'This function copies the internal state', cr
- db 'variables to a buffer area so they can be', cr
- db 'restored by Function 23.', null
-
- XFUNC23 db ' Function 23 (Advanced) Restore Mouse State', cr
- db ' ------------------------------------------', cr
- db 'Call: AX = 23', cr
- db ' DX = Offset of Far Ptr to Save-Buffer', cr
- db cr
- db 'Return:None', cr
- db cr
- db 'The complete Far Pointer is defined by the', cr
- db 'ES:DX register pair.', cr
- db cr
- db 'This function restores the internal state', cr
- db 'variables from the buffer area.', null
-
- XFUNC24 db 'Func 24 (Advanced) Define Alternate User Sub', cr
- db '--------------------------------------------', cr
- db 'Call: AX = 24', cr
- db ' CX = User Defined Event Mask', cr
- db ' DX = Offset of Far Ptr to User Sub', cr
- db 'Return:AX = -1 if error', cr
- db 'The complete Far Ptr is defined by ES:DX.', cr
- db 'Subs for mouse events that occur while Shift,', cr
- db 'Alt, and/or Ctrl keys are pressed. Subroutine', cr
- db 'is called when the Event Mask conditions are', cr
- db 'met. The Event Mask bits are defined:', cr
- db 'Bit # ->15 . . . 7 6 5 4 3 2 1 0', cr
- db 'FunC -> X . . . X A C S Rr Rp Lr Lp M', cr
- db 'M = Mouse Motion has occurred', cr
- db 'Lp = Left Button Pressed', cr
- db 'Lr = Left Button Released', cr
- db 'Rp = Right Button Pressed', cr
- db 'Rr = Right Button Released', cr
- db 'S = Shift Key', cr
- db 'C = Ctrl Key', cr
- db 'A = Alt Key', cr
- db 'x = Not used << press ENTER for MORE >>',lf
-
- XFUNC24A db 'Setting an Event Mask bit to one enables the', cr
- db 'condition. To disable any one of these calls,', cr
- db ' it is necessary to invoke Function #24 with', cr
- db 'the specific Comb.of the [A1t,Ctr1,Shift] set', cr
- db 'and wlth the mouse bits zeroed. Be certain to', cr
- db 'disable the call to your user defined sub when', cr
- db 'you exit from your application. Otherwise the', cr
- db 'next mouse motion will cause a Call through', cr
- db 'the dangling reference to uninitialized memory.', cr
- db 'These alternate routines will only be called if', cr
- db 'a selected combination of the keys in the set', cr
- db '[Alt,Ctrl,Shift] is pressed and one or more of', cr
- db 'the mouse bits are active. While a table of 7', cr
- db 'possible subroutines comprises all the possible', cr
- db 'combinations of the three keys the Microsoft', cr
- db 'driver only supports three alternate routines.', cr
- db ' << press ENTER for MORE>>',lf
-
- XFUNC24B db 'When the Event Mask conditions are satisfied and',cr
- db 'the Mouse Driver calls the User Subroutine,', cr
- db 'information concerning the mouse state is', cr
- db 'available in the following registers:', cr
- db 'AX = Event Integer - state of Event Mask Bits', cr
- db 'BX = Button Status', cr
- db 'CX = Cursor Position in Mouse-Screen Pixels', cr
- db 'DX = Cursor Position in Mouse-Screen Rasters', cr
- db 'DI = Motion Counter (Horizontal)', cr
- db 'SI = Motion Counter (Vertical)', cr
- db cr
- db 'This function should only be used by experienced',cr
- db 'programmers. The user subroutine is called at', cr
- db 'interrupt level from the mouse driver with', cr
- db 'interrupts enabled. This means that mouse ints', cr
- db 'will occur while your subroutine is active.', cr
- db 'The driver will not recursively call your', cr
- db 'subroutine, but you must exercise caution when', cr
- db 'calling mouse functions from your subroutine due',cr
- db 'to the possibility of changing internal driver', cr
- db 'data. Remember also that DOS is not reentrant!', null
-
- XFUNC25 db 'Func 25 (Advanced) Read Alt Subroutine Vector', cr
- db '---------------------------------------------', cr
- db 'Call: AX =25', cr
- db ' CX =Alternate Event Mask, bits 5,6,7 only',cr
- db cr
- db 'Return:AX = -1 if Alt Subroutine Pointer is null',cr
- db ' BX = Segment of Far Ptr to Alt Subroutine',cr
- db ' CX = Alternate Event Mask', cr
- db ' DX = Offset of Far Ptr to Alt Subroutine', cr
- db cr
- db 'This function is used to read the alternate sub', cr
- db 'vectors when a pop-up program wants to save the', cr
- db 'state of the vectors prior to defining its own.', cr
- db 'If AX = -1 then the particular vector requested', cr
- db 'is undefined.', null
-
- XFUNC26 db ' Function 26 (Advanced) Set Scaling Factors', cr
- db ' ------------------------------------------', cr
- db 'Call: AX = 26', cr
- db ' BX = Horizontal Scaling (1 to 100)', cr
- db ' CX = Vertical Scaling (1 to 100)', cr
- db ' DX = Double Speed Scaling (1 to 100)', cr
- db 'Return: None', cr
- db cr
- db 'If a scaling factor = 0, then that argument will',cr
- db 'not be changed.The mouse driver converts scaling',cr
- db 'factors to the nearest multiple of five. If 1 is',cr
- db 'entered the driver converts that to 0 so the', cr
- db 'minimum scaling factor is achieved. This func', cr
- db 'alters the effective mouse sensitivity. H and V', cr
- db 'Sensitivity settings control the ratio between', cr
- db 'Mouse-counts and the value that is processed by', cr
- db 'the driver to move the cursor. As you increase', cr
- db 'the sensitivity, the number of Mickeys processed',cr
- db 'for a given displacement of the mouse increases.',cr
- db 'The Mouse becomes more responsive as the', cr
- db 'sensitivity increases.', cr
- db ' << press ENTER for MORE >>',lf
-
- XFUNC26A db 'The Double Speed Sensitivity is also altered by', cr
- db 'its own scaling factor. Increasing the scaling', cr
- db 'factor means that the mouse must be moved faster',cr
- db 'in order to exceed the threshold.', cr
- db cr
- db 'The responsiveness of the mouse is controlled by',cr
- db 'Function 26 and Functions 15 and 19 working in', cr
- db 'parallel. The values set by Functions 15 and 19', cr
- db 'are restored tn their default values by a Func 0',cr
- db 'driver reset but not Func 26 Sensitivity.', cr
- db cr
- db 'The default Scaling Factor for all three', cr
- db 'quantities is 50, a number that does not alter', cr
- db 'the raw mouse-counts. A factor Of 70 approx.', cr
- db 'doubles the counts while 30 approx. halves them.',null
-
- XFUNC27 db ' Function 27 (Advanced) Get Scaling Factors',cr
- db ' -------------------------------------------',cr
- db 'Call: AX =27', cr
- db cr
- db 'Return:BX =Horizontal Scaling Factor (0 to 100)', cr
- db ' CX =Vertical Scaling Factor (0 to 100)', cr
- db ' DX =DoubleSpeed Threshold Scaling Factor', cr
- db ' (0 to 100)', null
-
- XFUNC28 db ' Function 28 Reserved', cr
- db ' -----------------------', null
-
- XFUNC29 db 'Function 29 (Advanced) Set Active Display Page', cr
- db '-----------------------------------------------', cr
- db 'Call: AX = 29', cr
- db ' BX = Active Display Page', cr
- db cr
- db 'Return: None', cr
- db cr
- db 'Applications that work with multiple display', cr
- db 'pages need to inform the mouse driver about', cr
- db 'the active display page so that the mouse cursor',cr
- db 'can be maintained.', null
-
- XFUNC30 db 'Function 30 (Advanced) Get Active Display Page', cr
- db '-----------------------------------------------', cr
- db 'Call: AX = 30', cr
- db cr
- db 'Return: BX = Active Display Page', null
-
- XFUNC31 db ' Function 31 (Advanced) Disable Mouse Driver', cr
- db ' -------------------------------------------', cr
- db 'Call: AX = 31', cr
- db cr
- db 'Return: AX = -1 if error', cr
- db ' BX = Offset of the old Int 33h Mouse', cr
- db ' Vector prior to the installation', cr
- db ' of the mouse driver.', cr
- db cr
- db 'The old Mouse Vector is defined by the ES:BX', cr
- db 'register pair. This function attempts to unhook', cr
- db 'the mouse driver Int 10h stub and mouse hdware', cr
- db 'interrupt vector. If there is no error, it', cr
- db 'then disables the mouse hardware interrupt and', cr
- db 'returns the old mouse vector so an application', cr
- db 'can restore the vector if desired. Usually the', cr
- db 'old mouse vector Points to a null handler in', cr
- db 'the BIOS or to 0000:0000. This function will', cr
- db 'return an error if it cannot unhook its vectors', cr
- db 'due to an intervening stub by another resident', cr
- db 'program. Check for an error return value!!!', null
-
- XFUNC32 db ' Function 32 (Advanced) Enable Mouse Driver', cr
- db ' -------------------------------------------', cr
- db cr
- db 'Call: AX = 32', cr
- db cr
- db 'Return: None', cr
- db cr
- db 'This function re-enables the driver and re-hooks',cr
- db 'Int 10h and hdwre interrupt vectors if necessary',null
-
- XFUNC33 db ' Function 33 Software Reset', cr
- db ' --------------------------', cr
- db cr
- db 'Call: AX = 33', cr
- db cr
- db 'Return: AX = -1 if driver is installed', cr
- db ' BX = 2(the number of mouse buttons)', cr
- db cr
- db 'This function is similar to Function 0 but does', cr
- db 'not Configure the mouse port. Note the', cr
- db 'inconsistent use of AX = -1 to indicate a', cr
- db 'successful return.', null
-
- XFUNC34 db ' Function 34 Set Language Byte', cr
- db ' -----------------------------', cr
- db 'Call: AX = 34', cr
- db ' BX = Language number', cr
- db cr
- db 'Number Language', cr
- db '----------------', cr
- db ' 0 English', cr
- db ' I French', cr
- db ' 2 Dutch', cr
- db ' 3 German', cr
- db ' 4 Swedish', cr
- db ' 5 Finnish', cr
- db ' 6 Spanish', cr
- db ' 7 Portugese', cr
- db ' 8 Italian', cr
- db cr
- db 'Return: None', cr
- db cr
- db 'This function stores a byte value that is', cr
- db 'interpreted by certain Microsoft utilities to', cr
- db 'set the language used.', null
-
- XFUNC35 db ' Function 35 Read Language Byte', cr
- db ' ------------------------------', cr
- db 'Call: AX = 35', cr
- db cr
- db 'Return: BX = Language Byte', cr
- db cr
- db 'This function returns the Language Byte', cr
- db 'that was set by Function 34', null
-
- XFUNC36 db ' Function 36 get Mouse and Driver Data', cr
- db ' -------------------------------------', cr
- db 'Call: AX = 36', cr
- db cr
- db 'Return: BX = Driver version (in BCD)', cr
- db ' CX = Interface Type in high byte', cr
- db ' IRQ # in low byte.', cr
- db cr
- db 'This function returns information about version', cr
- db 'of the mouse driver and the type of mouse.', cr
- db 'The driver version is the level of Microsoft', cr
- db 'driver that the mouse driver is compatible with.',cr
- db 'The version bytes are in Binary-Coded Decimal', cr
- db '(BCD) format. The high byte is the integer part', cr
- db 'and the low byte is the decimal part of the', cr
- db 'version number. The interface type returned in', cr
- db 'CX high byte is interpreted as follows:', cr
- db cr
- db ' 1 = 8255-based bus mouse', cr
- db ' 2 = serial mouse', cr
- db ' 3 = inport bus mouse', cr
- db ' 4 = PS/2-style mouse port', null
-
- ;
- ;-----------------------------------------------------------------------------
- ;Front-end routine for the keyboard interrupt handler. Execution is vectored
- ;here whenever an interrupt 9 is generated by the PC keyboard.
- ;-----------------------------------------------------------------------------
- mikview proc near
- cmp int_status,0 ;already displayed?
- jne short_exit ;yes, then exit immediately
- sti ;enable interrupts
- push ax ;save registers
- push bx
- push cx
- push dx
- push si
- push di
- push ds
- push es
- in al,kb_data ;get scan code from keyboard
- cmp al,m_key ;was the 'M' key pressed?
- jne exit ;no, then exit to normal routine
- mov ah,2 ;get state of shift keys
- int 16h
- test al,alt_key ;is the Alt key depressed?
- jne mik1 ;yes, then continue
- ;
- ;Exit is achieved thru here when execution is to be transferred to the normal
- ;BIOS keyboard interrupt handling routine.
- ;
- exit: pop es ;restore registers
- pop ds
- pop di
- pop si
- pop dx
- pop cx
- pop bx
- pop ax
- short_exit: jmp old_int_9h ;goto BIOS keyboard routine
- ;
- ;The key combination Alt-M was just pressed. Reset the keyboard and issue an
- ;EOI to the 8259 PIC to enable hardware interrupts.
- ;
- mik1: call kb_reset ;reset keyboard, end 8259 int
- push cs ;set DS and ES to the code segment
- pop ds
- push cs
- pop es
- assume ds:code
- ;
- ;Check the current video mode to see if it's one of the 80-column text modes
- ;(2, 3, or 7). If it is, then continue. If it's not, gracefully abort this
- ;routine by exiting thru an IRET.
- ;
- mov ah,15 ;get video page and display mode
- int 10h
- cmp al,2 ;video mode 2?
- je mik2 ;yes, then continue
- cmp al,3 ;mode 3?
- je mik2 ;yes, then continue
- cmp al,7 ;mode 7 (monochrome)?
- je mik2 ;yes, then continue
- done: pop es ;restore register values for exit
- pop ds
- pop di
- pop si
- pop dx
- pop cx
- pop bx
- pop ax
- iret ;return to interrupted program
- ;
- ;Save the current video page number and the cursor scan line parameters,
- ;set the interrupt routine status flag, and blank the cursor.
- ;
- mik2: mov video_page,bh ;save page number
- mov int_status,1 ;set interrupt routine status flag
- mov ah,3 ;get the cursor shape
- int 10h
- mov cursor_mode,cx ;save it
- mov ah,1 ;hide the cursor for now
- mov ch,20h
- int 10h
- ;
- ;Save the contents of the portion of the Qareen beneath the window.
- ;
- cmp adapter,0 ;is this a CGA?
- jne mik3 ;no, then skip disable
- call disable_cga ;disable CGA video
- mik3: mov di,screen_buffer ;point DI to storage buffer
- call save_screen ;save screen contents
- ;
- ;Pop the window border onto the display by writing directly to video. Finish
- ;things up by filling the blank window the first of the mouse functions
- ;
- call open_window ;pop up the window border
- cmp adapter,0 ;is this a CGA?
- jne mik4 ;no, then skip enable
- call enable_cga ;enable CGA video
- mik4: mov start_value,0 ;reset the index pointers
- mov func_index,0
- mov old_index, 255
- call fill_window ;write the window text
- ;
- ;The window is now displayed on the screen. Wait for a keypress.
- ;
- mik5: mov ah,0 ;get a keypress
- int 16h
- cmp al,0 ;is it an extended code?
- je mik10 ;yes, then jump
- cmp al,27 ;ESC key pressed?
- je get_lost
- cmp al,13 ;Enter Key Pressed
- jne mik5 ;no, then get another keypress
-
- mov al, func_index ;skip the explanation
- cmp al, old_index
- je skip_explanation
- mov old_index, al
-
- call clear_explanation ;or clear the old explanation
-
- mov dh, window_row ;now print the explanation
- add dh, 2
- mov dl, window_column
- add dl, 31
- mov al, func_index
- call func_explain
-
- skip_explanation:
- jmp mik5 ;return for another key press
-
- get_lost:
- ;
- ;The ESC key has been pressed. Restore the original contents of the screen,
- ;restore the cursor, reset the status flag, and exit to the application.
- ;
- cmp adapter,0 ;blank video if CGA installed
- jne mik6
- call disable_cga
- mik6: mov si,screen_buffer ;point SI to holding buffer
- call restore_screen ;restore video memory contents
- cmp adapter,0 ;enable video if necessary
- jne mik7
- call enable_cga
- mik7: mov ah,1 ;unblank the cursor
- mov cx,cursor_mode ;define cursor scan lines
- int 10h
- mov int_status,0 ;reset status flag
- jmp done ;exit
- ;
- ;A key has been pressed that returned an extended code.
- ;
- mik10: cmp ah,72 ;Up-Arrow pressed?
- jne mik11 ;no, then jump to next test
- call scroll_down ;yes, then scroll down
- jmp mik5 ;return for another keypress
- mik11: cmp ah,80 ;Down-Arrow pressed?
- jne mik12
- call scroll_up ;scroll window up
- jmp mik5
- mik12: cmp ah,73 ;PgUp pressed?
- jne mik13
- call last_window_page ;flip window page back
- jmp mik5
- mik13: cmp ah,81 ;PgDn pressed?
- jne mik14
- call next_window_page ;flip window page forward
- jmp mik5
- mik14: cmp ah,79 ;End pressed?
- jne mik15
- call end_window_page ;flip to last window page
- jmp mik5
- mik15: cmp ah,71 ;Home pressed?
- jne mik16 ;no, then start again
- call first_window_page ;goto first window page
- mik16: jmp mik5 ;look for another keypress
- mikview endp
- ;
- ;-----------------------------------------------------------------------------
- ;SAVE_SCREEN saves the contents of the screen beneath the window.
- ;Entry: ES:DI - buffer address
- ;-----------------------------------------------------------------------------
- save_screen proc near
- mov dh,window_row ;row and column of window corner
- mov dl,window_column
- mov bl,video_page ;get video page in BX
- xor bh,bh
- push di ;save buffer address
- call video_offset ;get starting address of window
- mov si,di ;transfer address to SI
- pop di ;retrieve buffer address
- push ds ;save DS
- mov ds,video_segment ;set DS to video segment
- assume ds:nothing
- mov cx,25 ;25 lines to save
- cld ;clear DF
- save1: push cx ;save line counter
- mov cx,80 ;80 words per line
- rep movsw ;transfer one line to buffer
- pop cx ;get line count
- loop save1 ;loop until done
- pop ds ;restore DS
- assume ds:code
- ret
- save_screen endp
- ;
- ;-----------------------------------------------------------------------------
- ;RESTORE_SCREEN restores the contents of the screen beneath the window.
- ;Entry: DS:SI - buffer address
- ;-----------------------------------------------------------------------------
- restore_screen proc near
- mov dh,window_row ;row & column where window starts
- mov dl,window_column
- mov bl,video_page ;get video page in BX
- xor bh,bh
- call video_offset ;get window starting address
- mov es,video_segment ;set ES to video segment
- mov cx,25 ;25 lines to restore
- cld ;clear DF
- restore1: push cx ;save line counter
- mov cx,80 ;80 words per line
- rep movsw ;restore one line
- pop cx ;retrieve count
- loop restore1 ;loop until done
- ret
- restore_screen endp
- ;
- ;-----------------------------------------------------------------------------
- ;VIDEO_OFFSET calculates the offset address in video memory that corresponds
- ;to the given row, column, and video page.
- ;Entry: DH,DL - row, column | Exit: DI - offset
- ; BX - video page |
- ;-----------------------------------------------------------------------------
- video_offset proc near
- mov al,160 ;row * 160
- mul dh ;result in AX
- shl dl,1 ;column * 2
- xor dh,dh ;byte to word in DX
- add ax,dx ;add the two
- mov di,ax ;save result in DI
- mov ax,1000h ;length of one video page
- mul bx ;page * 1000h
- add di,ax ;complete the offset address
- ret
- video_offset endp
- ;
- ;-----------------------------------------------------------------------------
- ;DISABLE_CGA and ENABLE_CGA routines disable and enable CGA video by writing
- ;to the Mode Select Register at port address 3D8h.
- ;-----------------------------------------------------------------------------
- disable_cga proc near
- mov dx,3DAh ;load Status Register address
- disable1: in al,dx ;get video status
- test al,8 ;vertical retrace active?
- je disable1 ;no, then wait until it is
- sub dx,2 ;load MSR address
- mov al,25h ;value to disable video
- out dx,al ;send it to the adapter
- ret
- disable_cga endp
- ;
- enable_cga proc near
- mov ah,15 ;get current video mode
- int 10h
- lea bx,enable_values ;offset of enable value table
- xlat ;get the value to enable video
- mov dx,3D8h ;load address of MSR
- out dx,al ;OUT the enable value
- ret
- enable_cga endp
- ;
- ;-----------------------------------------------------------------------------
- ;KB_RESET resets the keyboard and issues an EOI to the 8259 PIC.
- ;-----------------------------------------------------------------------------
- kb_reset proc near
- in al,kb_ctrl ;get current control port value
- mov ah,al ;save it in AH
- or al,80h ;set bit 7
- out kb_ctrl,al ;send reset value
- mov al,ah ;get original value
- out kb_ctrl,al ;send it out to enable keyboard
- cli ;suspend interrupts
- mov al,eoi ;get EOI value
- out int_ctrl_port,al ;send EOI to 8259
- sti ;enable interrupts
- ret
- kb_reset endp
- ;
- ;-----------------------------------------------------------------------------
- ;OUTPUT_CHAR writes the designated character directly to video memory.
- ;Entry: DH,DL - row, column
- ; AH,AL - attribute, character
- ;-----------------------------------------------------------------------------
- output_char proc near
- push dx ;save DX and AX
- push ax
- mov bl,video_page ;get page in BX
- xor bh,bh
- call video_offset ;calculate address to write to
- cmp adapter,0 ;is this a CGA?
- jne output3 ;no, then skip wait loop
- mov dx,3DAh ;get CGA Status Register address
- output1: in al,dx ;wait until horiz. retrace done
- test al,1
- jne output1
- cli ;suspend interrupts during write
- output2: in al,dx ;wait for next horizontal retrace
- test al,1
- je output2
- output3: pop ax ;get character and attribute
- stosw ;write them to video memory
- sti ;enable interrupts
- pop dx ;restore DX
- ret
- output_char endp
- ;
- ;-----------------------------------------------------------------------------
- ;FILL_WINDOW writes the text of the mouse function table to the window.
- ;-----------------------------------------------------------------------------
- fill_window proc near
-
- mov dh,window_row ;set DH for first text row
- add dh,2
-
- mov cx,16 ;16 lines to fill
- fill1: push cx ;save line counter
- mov dl,window_column ;specify starting column
- add dl,1
- mov al,start_value;
- call write_line
- inc dh ;set cursor for next row
- inc start_value;
- mov al,start_value;
- pop cx ;retrieve line counter
- loop fill1 ;loop until table full
- ret
- fill_window endp
-
- ;-----------------------------------------------------------------------------
- ;WRITE_TITLE outputs the title block
- ; DH,DL - row, column to start writing at
- ;-----------------------------------------------------------------------------
- ;
- ; explain the current mouse function
- ;
- write_title proc near
- mov es,video_segment ;set ES to video for writing
- lea si,titleblock ;point SI to text of line
- push cx
- mov dh,window_row
- add dh,18
- mov dl,window_column
- add dl,1
- mov ah,border_attr ;use border attribute first
- title_again: ;get the text character
- mov al,byte ptr[si]
- cmp al,0 ;if its a zero return
- je title_clear
- lodsb
- cmp al,cr ;if its not a carriage return
- je title_return
- call output_char ;print the chracter
- inc dl ;advance cursor
- jmp title_again
-
- title_return: inc dh ;do a hard return
- mov dl,window_column ;and make another pass
- add dl,1
- mov ah, title_attr
- jmp title_again
- title_clear:
- mov dh, window_row ;now print the int info
- add dh, 2
- mov dl, window_column
- add dl, 31
- mov al, 255
- call func_explain
-
- pop cx
- ret
- write_title endp
-
-
- ;
- ;-----------------------------------------------------------------------------
- ;WRITE_LINE outputs the description of the current mouse function.
- ;Entry: AL - index value for mouse function
- ; DH,DL - row, column to start writing at
- ;-----------------------------------------------------------------------------
- write_line proc near
- mov es,video_segment ;set ES to video for writing
- cmp al,0
- jne first
- lea si,FUNC00 ;point SI to text of line
- jmp print_here
- first: cmp al,1
- jne second
- lea si,FUNC01
- jmp print_here
- second: cmp al,2
- jne third
- lea si,FUNC02
- jmp print_here
- third: cmp al,3
- jne fourth
- lea si,FUNC03
- jmp print_here
- fourth: cmp al,4
- jne fifth
- lea si,FUNC04
- jmp print_here
- fifth: cmp al,5
- jne sixth
- lea si,FUNC05
- jmp print_here
- sixth: cmp al,6
- jne seventh
- lea si,FUNC06
- jmp print_here
- seventh: cmp al,7
- jne eighth
- lea si,FUNC07
- jmp print_here
- eighth: cmp al,8
- jne ninth
- lea si,FUNC08
- jmp print_here
- ninth: cmp al,9
- jne tenth
- lea si,FUNC09
- jmp print_here
- tenth: cmp al,10
- jne eleventh
- lea si,FUNC10
- jmp print_here
- eleventh: cmp al,11
- jne twelfth
- lea si,FUNC11
- jmp print_here
- twelfth: cmp al,12
- jne thirteen
- lea si,FUNC12
- jmp print_here
- thirteen: cmp al,13
- jne fourteen
- lea si,FUNC13
- jmp print_here
- fourteen: cmp al,14
- jne fifteen
- lea si,FUNC14
- jmp print_here
- fifteen: cmp al,15
- jne sixteen
- lea si,FUNC15
- jmp print_here
- sixteen: cmp al,16
- jne seventeen
- lea si,FUNC16
- jmp print_here
- seventeen: cmp al,17
- jne eighteen
- lea si,FUNC17
- jmp print_here
- eighteen: cmp al,18
- jne nineteen
- lea si,FUNC18
- jmp print_here
- nineteen: cmp al,19
- jne twenty
- lea si,FUNC19
- jmp print_here
- twenty: cmp al,20
- jne twentyone
- lea si,FUNC20
- jmp print_here
- twentyone: cmp al,21
- jne twentytwo
- lea si,FUNC21
- jmp print_here
- twentytwo: cmp al,22
- jne twentythree
- lea si,FUNC22
- jmp print_here
- twentythree: cmp al,23
- jne twentyfour
- lea si,FUNC23
- jmp print_here
- twentyfour: cmp al,24
- jne twentyfive
- lea si,FUNC24
- jmp print_here
- twentyfive: cmp al,25
- jne twentysix
- lea si,FUNC25
- jmp print_here
- twentysix: cmp al,26
- jne twentyseven
- lea si,FUNC26
- jmp print_here
- twentyseven: cmp al,27
- jne twentyeight
- lea si,FUNC27
- jmp print_here
- twentyeight: cmp al,28
- jne twentynine
- lea si,FUNC28
- jmp print_here
- twentynine: cmp al,29
- jne thirty
- lea si,FUNC29
- jmp print_here
- thirty: cmp al,30
- jne thirtyone
- lea si,FUNC30
- jmp print_here
- thirtyone: cmp al,31
- jne thirtytwo
- lea si,FUNC31
- jmp print_here
- thirtytwo: cmp al,32
- jne thirtythree
- lea si,FUNC32
- jmp print_here
- thirtythree: cmp al,33
- jne thirtyfour
- lea si,FUNC33
- jmp print_here
- thirtyfour: cmp al,34
- jne thirtyfive
- lea si,FUNC34
- jmp print_here
- thirtyfive: cmp al,35
- jne thirtysix
- lea si,FUNC35
- jmp print_here
- thirtysix: lea si,FUNC36
-
- print_here:
- push cx
- cmp al,func_index
- je hi_lite
- mov ah,text_attr ;otherwise use text attribute
- jmp goagain
- hi_lite: mov ah, reverse_attr
- goagain: ;get the text character
- mov al,byte ptr[si]
- cmp al,0
- je print_done
- lodsb
- call output_char ;print the digit
- inc dl ;advance cursor
- jmp goagain
- print_done:
- pop cx
- ret
- write_line endp
-
-
- ;-----------------------------------------------------------------------------
- ;FUNC_EXPLAIN outputs the explanation of the current mouse function.
- ;Entry: AL - index value for mouse function
- ; DH,DL - row, column to start writing at
- ;-----------------------------------------------------------------------------
- ;
- ; explain the current mouse function
- ;
- func_explain proc near
- mov es,video_segment ;set ES to video for writing
- cmp al,255
- jne dofunc ;if its not the int info
- lea si, XMOUSE ;then its a function explanation
- jmp explain_here
- dofunc:
- cmp al,0
- jne Xfirst
- lea si,XFUNC00 ;point SI to text of line
- jmp explain_here
- Xfirst: cmp al,1
- jne Xsecond
- lea si,XFUNC01
- jmp explain_here
- Xsecond: cmp al,2
- jne Xthird
- lea si,XFUNC02
- jmp explain_here
- Xthird: cmp al,3
- jne Xfourth
- lea si,XFUNC03
- jmp explain_here
- Xfourth: cmp al,4
- jne Xfifth
- lea si,XFUNC04
- jmp explain_here
- Xfifth: cmp al,5
- jne Xsixth
- lea si,XFUNC05
- jmp explain_here
- Xsixth: cmp al,6
- jne Xseventh
- lea si,XFUNC06
- jmp explain_here
- Xseventh: cmp al,7
- jne Xeighth
- lea si,XFUNC07
- jmp explain_here
- Xeighth: cmp al,8
- jne Xninth
- lea si,XFUNC08
- jmp explain_here
- Xninth: cmp al,9
- jne Xtenth
- lea si,XFUNC09
- jmp explain_here
- Xtenth: cmp al,10
- jne Xeleventh
- lea si,XFUNC10
- jmp explain_here
- Xeleventh: cmp al,11
- jne Xtwelfth
- lea si,XFUNC11
- jmp explain_here
- Xtwelfth: cmp al,12
- jne Xthirteen
- lea si,XFUNC12
- jmp explain_here
- Xthirteen: cmp al,13
- jne Xfourteen
- lea si,XFUNC13
- jmp explain_here
- Xfourteen: cmp al,14
- jne Xfifteen
- lea si,XFUNC14
- jmp explain_here
- Xfifteen: cmp al,15
- jne Xsixteen
- lea si,XFUNC15
- jmp explain_here
- Xsixteen: cmp al,16
- jne Xseventeen
- lea si,XFUNC16
- jmp explain_here
- Xseventeen: cmp al,17
- jne Xeighteen
- lea si,XFUNC17
- jmp explain_here
- Xeighteen: cmp al,18
- jne Xnineteen
- lea si,XFUNC18
- jmp explain_here
- Xnineteen: cmp al,19
- jne Xtwenty
- lea si,XFUNC19
- jmp explain_here
- Xtwenty: cmp al,20
- jne Xtwentyone
- lea si,XFUNC20
- jmp explain_here
- Xtwentyone: cmp al,21
- jne Xtwentytwo
- lea si,XFUNC21
- jmp explain_here
- Xtwentytwo: cmp al,22
- jne Xtwentythree
- lea si,XFUNC22
- jmp explain_here
- Xtwentythree: cmp al,23
- jne Xtwentyfour
- lea si,XFUNC23
- jmp explain_here
- Xtwentyfour: cmp al,24
- jne Xtwentyfive
- lea si,XFUNC24
- jmp explain_here
- Xtwentyfive: cmp al,25
- jne Xtwentysix
- lea si,XFUNC25
- jmp explain_here
- Xtwentysix: cmp al,26
- jne Xtwentyseven
- lea si,XFUNC26
- jmp explain_here
- Xtwentyseven: cmp al,27
- jne Xtwentyeight
- lea si,XFUNC27
- jmp explain_here
- Xtwentyeight: cmp al,28
- jne Xtwentynine
- lea si,XFUNC28
- jmp explain_here
- Xtwentynine: cmp al,29
- jne Xthirty
- lea si,XFUNC29
- jmp explain_here
- Xthirty: cmp al,30
- jne Xthirtyone
- lea si,XFUNC30
- jmp explain_here
- Xthirtyone: cmp al,31
- jne Xthirtytwo
- lea si,XFUNC31
- jmp explain_here
- Xthirtytwo: cmp al,32
- jne Xthirtythree
- lea si,XFUNC32
- jmp explain_here
- Xthirtythree: cmp al,33
- jne Xthirtyfour
- lea si,XFUNC33
- jmp explain_here
- Xthirtyfour: cmp al,34
- jne Xthirtyfive
- lea si,XFUNC34
- jmp explain_here
- Xthirtyfive: cmp al,35
- jne Xthirtysix
- lea si,XFUNC35
- jmp explain_here
- Xthirtysix: lea si,XFUNC36
-
- explain_here:
- push cx
- mov ah, header_attr ;use the reverse color for
- cmp al,255 ;the first screen only
- jne explainagain
- mov ah, reverse_attr
-
- explainagain: ;get the text character
- mov al,byte ptr[si]
- cmp al,0 ;if its a zero return
- je all_clear
- lodsb
- cmp al,cr ;if its not a carriage return
- je hard_return
- cmp al,lf
- je wait_key
- call output_char ;print the character
- inc dl ;advance cursor
- jmp explainagain
-
- hard_return: inc dh ;do a hard return
- mov dl,window_column ;and make another pass
- add dl,31
- jmp explainagain
- wait_key:
- mov old_index, 255 ;set flags for a wrap
- mov ah,0 ;get a keypress
- int 16h
- cmp al,13 ;was enter pressed
- jne all_clear ;no, then all clear
- call clear_explanation ;clear the screen
- mov dh,window_row
- add dh,2
- mov dl,window_column ;and make another pass
- add dl,31
- mov ah,header_attr
- jmp explainagain ;make another pass
-
- all_clear:
- pop cx
- ret
- func_explain endp
-
-
- ;
- ;-----------------------------------------------------------------------------
- ;OPEN_WINDOW draws the window border onto the screen. Character/attribute
- ;pairs are sent directly to video memory for fast display speed.
- ;-----------------------------------------------------------------------------
- open_window proc near
- mov dh,window_row ;get coordinates of window corner
- mov dl,window_column
- mov es,video_segment ;point ES to video buffer
- cld ;clear DF for string operations
- mov bl,video_page ;get video page in BX
- xor bh,bh
- call video_offset ;calculate starting address
- ;
- ;Write the top line of the window border to video.
- ;
- mov al,218 ;start with upper left corner
- mov ah,border_attr ;set attribute
- stosw
- mov cx,78 ;do the next 78 characters
- mov al,196
- rep stosw
- mov al,191 ;do upper right corner
- stosw
- ;
- ;Do the window header line.
- ;
- mov al,179 ;left window border character
- stosw ;write it
- lea si,header_text ;point SI to text of line
- mov cx,28 ;28 characters to write
- mov ah,header_attr ;use header attribute for these
- open1: lodsb ;get the text character
- stosw ;write char/attr pair to video
- loop open1 ;repeat for all 27
-
- mov ah,border_attr
- mov cx,50 ;next 50 characters
- mov al,196
- rep stosw
- mov ah,border_attr ;do rightmost column
- mov al,179
- stosw
- ;
- ;Now write the next 22 lines (no text) to the display.
- ;
- mov cx,22 ;22 lines to do
- open2: push cx ;save line counter
- mov al,179 ;do leftmost column
- mov ah,border_attr
- stosw
- mov al,32 ;do next 28 columns (blank)
- mov ah,text_attr
- mov cx,28
- rep stosw
- mov ah,border_attr
- mov al,179
- stosw
- mov ah,reverse_attr
- mov al,32
- mov cx,49
- rep stosw
- mov al,179 ;do rightmost column
- mov ah,border_attr
- stosw
- pop cx ;retrieve counter
- loop open2 ;loop until finished
- ;
- ;Finish things up by writing the last line.
- ;
- mov al,192 ;lower left corner
- stosw
- mov cx,78 ;next 78 characters
- mov al,196
- rep stosw
- mov al,217 ;lower right corner
- stosw
- ;
- ;now write the title
- ;
- call write_title
- ret
- open_window endp
-
- ;
- ;-----------------------------------------------------------------------------
- ;CLEAR_EXPLANATION clears the explanation box.
- ;-----------------------------------------------------------------------------
- clear_explanation proc near
- mov es,video_segment ;point ES to video buffer
- mov al,32
- mov ah, border_attr ;use border attribute for these
- mov dl, window_column
- add dl, 30
- mov dh, window_row
- add dh, 2
- push cx
- outerloop: mov cx, 49
- innerloop: ;get the text character
- call output_char ;print the digit
- inc dl ;advance cursor
- loop innerloop ;repeat for all 48
- inc dh
- cmp dh,24
- je endof_loop ;do a hard return
- mov dl,window_column ;and make another pass
- add dl,30
- jmp outerloop
- endof_loop:
- pop cx
- ret
- clear_explanation endp
-
- ;
- ;-----------------------------------------------------------------------------
- ;SCROLL_UP scrolls the window contents up one line.
- ;-----------------------------------------------------------------------------
- scroll_up proc near
- cmp func_index,36
- je scrlup0
- inc func_index
-
- sub start_value,15 ;subtract 15 from start value
- scrlup0:
- cmp start_value,21 ;are we at the top yet
- jb scrlup1 ;otherwise we are still ok
- mov start_value,21;
- scrlup1:
- call fill_window;
- ret
- scroll_up endp
- ;
- ;-----------------------------------------------------------------------------
- ;SCROLL_DOWN scrolls the window contents down one line.
- ;-----------------------------------------------------------------------------
- scroll_down proc near
- cmp func_index,0
- je scrldn0
- dec func_index
- scrldn0:
- cmp start_value,17
- jb scrldn1
- sub start_value,17
- ja scrldn2
- scrldn1:
- mov start_value,0
- scrldn2:
- call fill_window;
- ret
- scroll_down endp
- ;
- ;-----------------------------------------------------------------------------
- ;LAST_WINDOW_PAGE pages the window back one page.
- ;-----------------------------------------------------------------------------
- last_window_page proc near
- cmp func_index, 16
- jb last
- sub func_index, 16
- jmp last0
- last: mov func_index, 0
- last0:
- cmp start_value,32
- jb last1
- sub start_value,32
- ja last2
- last1:
- mov start_value,0
- last2:
- call fill_window ;write the new page
- ret
- last_window_page endp
- ;
- ;-----------------------------------------------------------------------------
- ;NEXT_WINDOW_PAGE pages the window forward one page.
- ;-----------------------------------------------------------------------------
- next_window_page proc near
- add func_index, 16
- cmp func_index, 36
- jb next0
- mov func_index, 36
- next0: cmp start_value,21
- jb next1 ;yes, then jump
- mov start_value,21 ;otherwise do the last page
- next1:
- call fill_window ;write new text page
- ret
- next_window_page endp
- ;
- ;-----------------------------------------------------------------------------
- ;FIRST_WINDOW_PAGE flips the window contents to the first page.
- ;-----------------------------------------------------------------------------
- first_window_page proc near
- mov func_index, 0
- mov start_value,0
- call fill_window ;write text to window
- first1: ret
- first_window_page endp
- ;
- ;-----------------------------------------------------------------------------
- ;END_WINDOW_PAGE flips the window contents to the final page.
- ;-----------------------------------------------------------------------------
- end_window_page proc near
- mov func_index, 36
- mov start_value,21
- call fill_window ;write window text
- end1: ret
- end_window_page endp
-
- ;-----------------------------------------------------------------------------
- ;LIST$ writes a string to stdout
- ;-----------------------------------------------------------------------------
- list$ proc near
- push ax
- mov ah,9h ; call dos function 9H
- int 21h
- pop ax
- ret
- list$ endp
-
- ;-----------------------------------------------------------------------------
- ;INITIALIZE performs a variety of tasks to set the stage for the resident part
- ;of the program.
- ;-----------------------------------------------------------------------------
- initialize proc near
- ;
- ;See if the display adapter is an EGA by looking for the EGA BIOS signature.
- ;
- mov ax,0C000h ;set ES to EGA BIOS segment
- mov es,ax
- mov di,1Eh ;point DI to signature location
- lea si,ibm_signature ;point SI to 'IBM' text
- mov cx,3 ;three bytes to compare
- cld ;clear DF
- repe cmpsb ;check three bytes
- je init1 ;jump if EGA signature found
- ;
- ;The display adapter is not an EGA. Determine whether it's a CGA or an MDA.
- ;
- mov adapter,0 ;zero ADAPTER for CGA
- mov ah,15 ;get video mode
- int 10h
- cmp al,7 ;is it mode 7?
- jne init1 ;no, then it's a CGA - jump
- inc adapter ;yes, it's an MDA - set ADAPTER
- ;
- ;If this is a monochrome system, modify color-dependent values accordingly.
- ;
- init1: cmp al,7 ;is current video mode 7?
- je init2 ;yes, then branch
- cmp al,15 ;is current video mode 15?
- jne init3 ;no, then skip modification code
- init2: sub video_segment,800h ;set VIDEO_SEGMENT for monochrome
- mov border_attr,07h ;change attributes for monochrome
- mov text_attr,07h
- mov header_attr,07h
- mov reverse_attr,70h
- mov title_attr,70h
- ;
- ;Reset the cursor to scan lines 6 and 7 (color) or 12 and 13 (monochrome).
- ;
- init3: mov cx,0C0Dh ;monochrome cursor type
- cmp al,7 ;video mode 7?
- je init4 ;yes, then jump
- cmp al,15 ;video mode 15?
- je init4 ;yes, then jump
- mov cx,0607h ;scan lines 6 and 7 for color
- init4: mov ah,1 ;set cursor type
- int 10h
- ;
- ;before we go, let them know who we are
- ;
- lea dx, credit$
- call list$
- ;
- ;Now save the old interrupt 9 vector and replace it with one pointing to the
- ;code that we will leave behind in memory.
- ;
- mov ah,35h ;get current interrupt 9 vector
- mov al,9
- int 21h
- mov old_keyboard_int,bx ;save vector offset
- mov old_keyboard_int[2],es ;save vector segment
- mov ah,25h ;set new vector
- mov al,9
- lea dx,mikview ;point it to body of program
- int 21h
- ;
- ;Exit thru INT 27h and reserve enough room beyond the actual code to store the
- ;contents of the area of screen that underlies the pop-up window.
- ;
- mov dx,offset initialize+4000 ;reserve space for code and buffer
- int 27h ;terminate-but-stay-resident
-
- initialize endp
- ;
- code ends
- end begin